"use strict";
const e = require("../common/vendor.js"),
  t = require("./my-account.js");
var o = new e.COS({
  SecretId: t.SECRETID,
  SecretKey: t.SECRETKEY,
  Protocol: "https:",
  UseAccelerate: !0,
  SimpleUploadMethod: "putObject"
});
exports.upLoadCos = function (n) {
  const a = [];
  return new Promise((async (s, c) => {
    const r = n.map((e => {
      const o = e.tempFilePath.split("."),
        n = `${Date.now()}-${Math.floor(1e7*Math.random(0,1))}.${o[o.length-1]}`;
      return {
        Bucket: t.BUCKET,
        Region: t.REGION,
        Key: `${t.FOLDER}${n}`,
        FilePath: e.tempFilePath
      }
    }));
    console.log(r), o.uploadFiles({
      files: r
    }, ((t, o) => {
      t ? (e.wx$1.hideLoading(), c(t)) : (o.files.forEach((e => a.push(`https://${e.data.Location}`))), s(a), e.wx$1.hideLoading())
    }))
  }))
};